package com.buaa.pm.controller;

import com.buaa.pm.entity.ExtractRecord;
import com.buaa.pm.model.ResultModel;
import com.buaa.pm.model.vo.ExtractRecordVO;
import com.buaa.pm.model.vo.ExtractResultVO;
import com.buaa.pm.service.ExtractRecordService;
import com.buaa.pm.service.ExtractResultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/extract")
public class ExtractController {

    @Autowired
    private ExtractResultService extractResultService;

    @Autowired
    private ExtractRecordService extractRecordService;

    @GetMapping("/list-by-task")
    public ResultModel<List<ExtractResultVO>> listByTask(@RequestParam String taskId) {
        return ResultModel.success(extractResultService.listExtractResultByTask(taskId));
    }

    @GetMapping("/list-record-by-task")
    public ResultModel<List<ExtractRecordVO>> listRecordByTask(@RequestParam String taskId){
        return ResultModel.success(extractRecordService.listExtractRecordByTask(taskId));
    }
}
